<template>
  <el-scrollbar>
    <el-card class="card">
      <el-row>
        <el-col :span="12">
          <el-row align="middle" style="height: 100%;">
            检查更新
          </el-row>
        </el-col>
        <el-col :span="12">
          <el-row justify="end">
            <el-button @click="checkUpdate">检查</el-button>
          </el-row>
        </el-col>
      </el-row>
    </el-card>
    <el-card class="card">
      <el-row>
        <el-col :span="12">
          <el-row align="middle" style="height: 100%;">
            开机自启
          </el-row>
        </el-col>
        <el-col :span="12">
          <el-row justify="end">
            <el-switch v-model="value1"/>
          </el-row>
        </el-col>
      </el-row>
    </el-card>
  </el-scrollbar>
</template>

<script>
import {ref, unref, getCurrentInstance, watch, reactive, onMounted} from "vue";
import {ElMessage, ElMessageBox, ElNotification} from 'element-plus';
import {useRouter} from "vue-router";

export default {
  name: "index",
  props: ["info"],
  emits: ["update:info"],
  components: {},
  setup(props, content) {
    const router = useRouter()
    const {proxy} = getCurrentInstance();
    let data = {
      value1: ref(false)
    }
    //监听
    watch(() => [props.info], ([newInfo], [oldInfo]) => {
      // if (newInfo){
      //   Object.assign(data.form, newInfo)
      // content.emit('update:info',newInfo)
      // }
    })
    onMounted(async () => {

    })
    let methods = {
      checkUpdate() {
        window.electron.ipcRenderer.send('check-for-updates')
      },
    }

    return {
      proxy,
      router,
      ...data,
      ...methods
    }
  }
}
</script>
<style lang="scss" scoped>
.card {
  margin-bottom: 20px;
}

</style>
